package com.greenDao.activity.modify;

import android.os.Bundle;

import com.greenDao.activity.R;
import com.greenDao.activity.tool.GuiUtils;
import com.greenDao.activity.tool.button.BackButton;
import com.greenDao.activity.tool.button.movie.ModifyUpdateMovieButton;

public class ModifyMovieActivity extends AbstractModifyActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_modify_movie);

		Long id = getIntent().getExtras().getLong("id");
		String title = getIntent().getExtras().getString("title");
		String director = getIntent().getExtras().getString("director");
		Integer year = getIntent().getExtras().getInt("year");
		Double rate = getIntent().getExtras().getDouble("rate");

		GuiUtils.setDefaultEditText(this, R.id.titleModify, title);
		GuiUtils.setDefaultEditText(this, R.id.directorModify, director);
		GuiUtils.setDefaultEditText(this, R.id.yearModify, year);
		GuiUtils.setDefaultEditText(this, R.id.rateModify, rate);

		GuiUtils.hookButton(this, R.id.modifyBack, new BackButton(this));
		GuiUtils.hookButton(this, R.id.modifyMovie, new ModifyUpdateMovieButton(this, id));
	}
}
